package com.ui.basic.command;

import java.util.List;

import org.springmodules.validation.bean.conf.loader.annotation.handler.Expression;
import org.springmodules.validation.bean.conf.loader.annotation.handler.Length;
import org.springmodules.validation.bean.conf.loader.annotation.handler.NotBlank;
import org.springmodules.validation.bean.conf.loader.annotation.handler.NotNull;

import com.common.basic.base.BaseCommand;
import com.common.basic.util.ComboValue;
import com.common.basic.util.Globals;
import com.ui.basic.ibatis.model.system.TblSUser;

public class CommandUser extends BaseCommand implements java.io.Serializable {
	
	private static final long serialVersionUID = -2996842014118093011L;

	private String srtADD = Globals.ACTION_ADD;

	private Long id;

	@Length(max = 36)
	@NotBlank(applyIf = "strAction == srtADD")
	private String userId;

	@NotBlank(applyIf = "strAction == srtADD")
	@Length(max = 32)
	private String password;

	@Length(max = 32)
	@Expression(value = "verifyPassword == password")
	private String verifyPassword;

	@NotNull
	private Long roleId;
	@NotNull
	private Long locId;

	private String ip;
	private Boolean issso;
	private Boolean passwordStatus;

	private List<ComboValue> roleCB;
	private List<ComboValue> locCB;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getVerifyPassword() {
		return verifyPassword;
	}

	public void setVerifyPassword(String verifyPassword) {
		this.verifyPassword = verifyPassword;
	}

	public Long getRoleId() {
		return roleId;
	}

	public void setRoleId(Long roleId) {
		this.roleId = roleId;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public Boolean getIssso() {
		return issso;
	}

	public void setIssso(Boolean issso) {
		this.issso = issso;
	}

	public Boolean getPasswordStatus() {
		return passwordStatus;
	}

	public void setPasswordStatus(Boolean passwordStatus) {
		this.passwordStatus = passwordStatus;
	}

	public void setProperty(TblSUser user) {
		this.id = user.getId();
		this.userId = user.getUsername();
		this.roleId = user.getRoleId();
		this.locId = user.getLocId();
		this.ip = user.getIp();
		this.issso = user.getIssso();
		this.passwordStatus = (user.getLocktimestamp() != null);
	}

	public void setRoleCB(List<ComboValue> roleCB) {
		this.roleCB = roleCB;
	}

	public List<ComboValue> getRoleCB() {
		return roleCB;
	}

	public void setSrtADD(String srtADD) {
		this.srtADD = srtADD;
	}

	public String getSrtADD() {
		return srtADD;
	}

	public void setLocId(Long locId) {
		this.locId = locId;
	}

	public Long getLocId() {
		return locId;
	}

	public void setLocCB(List<ComboValue> locCB) {
		this.locCB = locCB;
	}

	public List<ComboValue> getLocCB() {
		return locCB;
	}
}